// components/store/storeEvaluationFilter/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    tagList: {
      type: Array
    },
    active: {
      type: [Number, String],
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    currentTagIndex: 0,
    tabActive: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onTabsChange(event) {
      const { name } = event.detail
      const { currentTagIndex } = this.data
      const { tagList } = this.properties
      this.setData({
        tabActive: name
      })
      this.triggerEvent('change', {
        type: name,
        tag: tagList[currentTagIndex] && tagList[currentTagIndex].tagtype
      })
    },
    onTagChange(event) {
      const { tagtype, index } = event.currentTarget.dataset
      const { currentTagIndex } = this.data
      const { tagList } = this.properties
      if (index !== currentTagIndex) {
        this.setData({
          currentTagIndex: index
        })
        this.triggerEvent('change', {
          type: this.data.tabActive,
          tag: tagtype
        })
      }
      
    }
  }
})
